FROM ubuntu:16.04


RUN echo "deb http://archive.ubuntu.com/ubuntu/ xenial main restricted"          >  /etc/apt/sources.list && \
    echo "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted"  >> /etc/apt/sources.list && \
    echo "deb http://archive.ubuntu.com/ubuntu/ xenial universe"                 >> /etc/apt/sources.list && \
    echo "deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe"         >> /etc/apt/sources.list && \
    echo "deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted" >> /etc/apt/sources.list && \
    echo "deb http://archive.ubuntu.com/ubuntu/ xenial-security universe"        >> /etc/apt/sources.list


RUN apt-get -q update && \
    apt-get -qy install --no-install-recommends \
    language-pack-zh-hans \
    language-pack-en \
    supervisor

RUN apt-get -q update && \
    apt-get -qy install --no-install-recommends \
    mariadb-server-core-10.0 mariadb-server-10.0 mariadb-client-10.0

ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN set -x && \
  echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
  update-locale "LC_ALL=en_US.UTF-8" "LANG=en_US.UTF-8" && \
  locale-gen --purge "en_US.UTF-8" && \
  dpkg-reconfigure -f noninteractive locales

#设置时间
RUN apt-get install -y tzdata && \
  cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN mkdir -p /var/run/mysqld/ && \
  chown -R mysql.mysql /var/run/mysqld/

ADD etc /var/www/etc
RUN mv /var/www/etc/supervisor/conf.d/webapp_https.conf /etc/supervisor/conf.d/
RUN mv /var/www/etc/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf

CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]